package com.evil.application.api;

import com.evil.application.config.FeignErrorDecoder;
import com.evil.application.pojo.dto.form.ControlDataRespDTO;
import com.evil.application.pojo.dto.order.exp.OrderExportReqDTO;
import com.evil.application.pojo.dto.order.imp.ExcelImportReqDTO;
import com.evil.common.application.dto.ApplicationKeyReqDTO;
import com.evil.common.core.constant.ServiceNameConstant;
import com.evil.common.core.entity.QueryModel;
import com.evil.common.file.dto.FileRespDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 应用订单操作接口
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@FeignClient(name = ServiceNameConstant.APPLICATION_SERVICE, configuration = {FeignErrorDecoder.class})
public interface RemoteAppOrderOperationService {

    /**
     * 获取应用订单导入模板控件数据
     *
     * @param applicationKeyReqDTO applicationKeyReqDTO
     * @return ControlDataRespDTO
     */
    @PostMapping("/remote/application/download/template")
    ControlDataRespDTO downloadTemplate(@Validated @RequestBody ApplicationKeyReqDTO applicationKeyReqDTO);

    /**
     * 获取应用模板名称
     *
     * @param applicationKey applicationKey
     * @return applicationName
     */
    @PostMapping("/remote/application/get/app-template/name")
    String getAppTemplateName(@RequestParam("applicationKey") String applicationKey);

    /**
     * 应用订单导入
     *
     * @param excelImportReqDTO excelImportReqDTO
     */
    @PostMapping(value = "/remote/application/order/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    void orderDataImport(@Validated ExcelImportReqDTO excelImportReqDTO);

    /**
     * 获取订单控件数据列表
     *
     * @param queryModel queryModel
     */
    @PostMapping(value = "/remote/application/order/export")
    void orderDataExport(@Validated @RequestBody QueryModel<OrderExportReqDTO> queryModel);
}
